import Vue from 'vue'
import moment from 'moment'
import imgStep1 from '../../static/step1.png'

Vue.filter('img', value => 'http://img.test.com' + value)

Vue.filter('time', time => moment(time).format('YYYY/MM/DD HH:mm:ss'))

Vue.filter('tranString', function (json) {
  return JSON.stringify(json)
})

Vue.filter('transJson', function (string) {
  return JSON.parse(string)
})

Vue.filter('transImg', function (status) {
//  console.log(status)
  if (status === '' || status === '待清洗' || status === '清洗中' || status === '待下发' || status === '已下发' || status === '已分配') {
    return imgStep1
  } else if (status === '已跟进' || status === '冷线索') {
    return '../static/step2.png'
  } else if (status === '已进店' || status === ' 已成交未实销 ') {
    return '../static/step3.png'
  } else if (status === '已成交已实销') {
    return '../static/step4.png'
  } else if (status === '已废弃' || status === '已战败') {
    return '../static/step3.png'
  } else if (status === '重复') {
    return '../static/step3.png'
  }
})
